<div class="user">
Hello <?php echo $this->username;?> ( <a href="<?php echo $this->url(array('controller'=>'auth', 'action'=>'logout'));?>">Logout</a>)
</div>
<br/>
<div class="list">
	<form name="frmSearch" id="frmSearch" method="POST"
		action="<?php echo $this->url(array('controller'=>'comment', 'action'=>'search'));?>">
	<table>
		<tr>
			<td>ID: </td>
			<td><input type="text" class="id" name="id" id="id"></input></td>
		</tr>
		<tr>
			<td>VN: </td>
			<td><input type="text" class="vn" name="vn" id="vn"></input></td>
		</tr>
		<tr>
			<td>JP: </td>
			<td><input type="text" class="jp" name="jp" id="jp"></input></td>
		</tr>
		<tr>
			<td>Owner: </td>
			<td><input type="text" name="username" id="username"></input></td>
		</tr>
		<tr>
			<td><input type="button" value="Search" onclick="loadPage(1)"></input></td>
			<td><a href="<?php echo $this->baseUrl()?>comment/add" class="modal">Add new comment</a></td>
		</tr>
	</table>
	</form>
     <div id="ulist">
     </div>
        <?php $linkpage = $this->baseUrl()."/comment/list/page" ;?>
        <?php $linksavecondition = $this->baseUrl()."/comment/savecondition" ;?>
      <script type="text/javascript">
        var gobal_page = 1;
       $(document).ready(function(  ){
           $("#ulist").load("<?php echo  $linkpage . '/1';?>");
       });

        function loadPage(page) {
        	var vn = "";
            var jp = "";
            var username = "";
            var arr = new Object();
            
            if ($("#vn").val() != "") {
            	arr["vn"] = $("#vn").val();
            }
            if ($("#jp").val() != "") {
            	arr["jp"] = $("#jp").val();
            }
            if ($("#username").val() != "") {
            	arr["username"]  = $("#username").val();
            }
            
            $.ajax({
				type: "POST",
				url: "<?php echo  $linksavecondition . '/';?>",
				async: false,
				data: arr
			});

	        $("#ulist").load("<?php echo  $linkpage . '/';?>"  + page);
	        gobal_page = page;
        }

        function check_del(id) {
	        if (confirm('Do you want delete this comment ?')) {
		        location='<?php echo $this->base; ?>/comment/delete/id/'+id;
	        }
	        return false;
        }
    </script>

</div>